const app = getApp()

Page({
  data: {
    active:0,
  },

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function (options) {
		this.getStore();
	},
	//获取商品列表
	getStore: function () {
		if(!app.util().isNull(this.data.keyword)){
			var parms = {
				page:1,
				cate_id: 0,
				cate_sid: 0,
				keyword: this.data.keyword,
			}
			app.api().Get('api/v1/ais/store/lists',parms,(result) =>{
				this.setData({
					stores: result.data,
				});
			})
		}
	},
 	//搜索
	 onSearch: function (event) {
		if (app.util().isNull(event.detail)) {
			app.wxAlert('请输入搜索关键词')
			this.setData({
				loading: false,
			})
		} else {
			this.setData({
				loading: true,
				page: 0,
				keyword:event.detail,
				stores: [],
				shop: [],
			})
			this.getStore();
			this.getItem();
		}
	}
})